package com.shop.service.impl;

import java.util.List;

import com.shop.bean.Goods;
import com.shop.bean.Page;
import com.shop.dao.GoodsDao;
import com.shop.dao.impl.GoodsDaoImpl;
import com.shop.service.GoodsService;

public class GoodsServiceImpl implements GoodsService{

	private GoodsDao goodsDao = new GoodsDaoImpl();
	
	@Override
	public Page<Goods> getAllGoods(int pageNum,int pageSize) {
		List<Goods> goodsList = goodsDao.selectAllGoods(pageNum, pageSize);
		int rows = goodsDao.selectAllGoodsNum();
		Page<Goods> page = new Page(goodsList,pageNum,pageSize,rows);
		return page;
	}

	@Override
	public int deleteGood(int goodsId) {
		
		return goodsDao.deleteGoodById(goodsId);
	}

}

